
/**
 * Project Name:cats-core-impl
 * File Name:UserDao.java
 * Package Name:com.catsic.core.user.dao
 * Date:2014年2月27日下午1:31:10
 * Copyright (c) 2014, oa.catsic.com All Rights Reserved.
 */
 
package com.catsic.core.user.dao;

import java.util.List;

import javax.persistence.QueryHint;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.QueryHints;

import com.catsic.base.BaseDao;
import com.catsic.core.entity.User;


/**
 * ClassName: UserDao
 * Description: 用户Dao接口类
 * date: 2014年2月27日 下午1:31:10
 * author: yangyd
 */
public interface UserDao extends BaseDao<User,String>{
	/**
	 * findByUsername:通过用户名查找用户
	 * @author yangyd
	 * @param username
	 * @return User
	 */
	public User findByUsername(String username);
	
	/**
	 * findByIdentity:通过身份证获取用户
	 * @author yangyudi
	 * @param identity
	 * @return
	 */
	public User findByIdentity(String identity);
	
	/**
	 * 获取该机构下所有用户
	 * @param organCode
	 * @return
	 */
	@Query("select u from User u where u.organ.code like ?1")
	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value ="true") })
	public List<User> findByLikeOrganCode(String organCode);
}
